package oauthBean

const ParamOAuthKey = "oauth-info"

type ParamOAuth struct {
	Source map[string]*AppInfo `json:"source"`
}

type AppInfo struct {
	ClientId     string `json:"clientId"`
	ClientSecret string `json:"clientSecret"`
	SourceHost   string `json:"sourceHost"`
}

func (c *ParamOAuth) DefAppInfo() (string, *AppInfo) {
	if c.Source == nil {
		return "", nil
	}
	for k, v := range c.Source {
		return k, v
	}
	return "", nil
}
func (c *ParamOAuth) AppInfo(source string) (*AppInfo, bool) {
	if c.Source == nil {
		return nil, false
	}
	v, ok := c.Source[source]
	return v, ok
}
